//
//  ShenHeViewController.m
//  FactorySale
//
//  Created by 李 on 2020/3/27.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "ShenHeViewController.h"
#import "ShippingAddressViewController.h"// 收货地址控制器
#import "ShenHeFinishedViewController.h"// 流程已完成控制器
#import "IQTextView.h"
#import "ShippingAddressListModel.h"
#import "IssueNowAlertController.h"// 立即发放弹框
#import "IssueNowNoMoneyAlertController.h"// 余额不足弹框
#import "BalanceModel.h"
#import "GrantChuLiZhongViewController.h"
@interface ShenHeViewController ()<UITextViewDelegate>
@property(nonatomic,strong)UIView *selectBackView;// 审核方式选择view
@property(nonatomic,strong)UIView *addressBackView;// 回寄地址view
@property(nonatomic,strong)UIView *reasonBackView;// 驳回原因view
@property(nonatomic,strong)IQTextView *reasonTextView;// 驳回理由输入框
// 三个选择button和可点击的label（label上添加了点击手势）
@property(nonatomic,strong)UIButton *btn1;
@property(nonatomic,strong)UIButton *btn2;
@property(nonatomic,strong)UIButton *btn3;
@property(nonatomic,strong)UILabel *lab1;
@property(nonatomic,strong)UILabel *lab2;
@property(nonatomic,strong)UILabel *lab3;

@property(nonatomic,strong)UIButton *sureBut;// 确定
@property(nonatomic,strong)NSMutableArray *addressListArray;
@property(nonatomic,strong)UILabel *nameLab;
@property(nonatomic,strong)UILabel *phoneLab;
@property(nonatomic,strong)UILabel *addressLab;

//审核接口 需要上传的字段
@property(nonatomic,strong)NSString *wayStr;// 审核方式
@property(nonatomic,strong)NSString *factoryNameStr;// 名称
@property(nonatomic,strong)NSString *factoryPhoneStr;// 电话
@property(nonatomic,strong)NSString *factoryAddressStr;// 地址
@property(nonatomic,strong)NSString *refuseStr;// 拒绝理由

@property(nonatomic,strong)UIImageView *emptyImageView;// 空空如也图片
@property (weak, nonatomic) IBOutlet UIView *giveMoneyAlertView;

@property (nonatomic,strong)BalanceModel *balanceModel;
@end

@implementation ShenHeViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"审核";
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    self.view.backgroundColor = kColorWithHex(0xF5F5F5);
    
    self.wayStr = @"";
    
    [self configViews];
}

-(void)configViews
{
    // 选择审核方式视图
    [self configSelectView];
    // 地址选择视图
    [self configAddressView];
    // 拒绝理由视图
    [self configReasonView];
    // 确定按钮
    [self configFooterView];
    self.addressBackView.hidden = YES;
    self.reasonBackView.hidden = YES;
}

//审核方式选择view
-(void)configSelectView
{
    UIView *selectBackView = [[UIView alloc]initWithFrame:CGRectMake(0,kNaviHeight+10, ScreenW, 172)];
    selectBackView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:selectBackView];
    self.selectBackView = selectBackView;
    
    //请选择审核方式
    UILabel *typeWordLab = [[UILabel alloc] init];
    typeWordLab.frame = CGRectMake(15, 10, 200, 12);
    typeWordLab.font = KFontPingFangSCMedium(13);
    typeWordLab.textColor = K333333;
    typeWordLab.text = @"请选择审核方式";
    [selectBackView addSubview:typeWordLab];
    
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(15,typeWordLab.bottom+10, ScreenW-30, 0.5)];
    lineView.backgroundColor = kColorWithHex(0xE5E5E5);
    [selectBackView addSubview:lineView];
    
    //无法确定故障，请回寄产品（邮寄费用需自行承担）
    UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(30, lineView.bottom+23, 15, 15)];
    [btn1 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(btn1Click) forControlEvents:UIControlEventTouchUpInside];
    [selectBackView addSubview:btn1];
    self.btn1 = btn1;
    
    UILabel *lab1 = [[UILabel alloc] init];
    lab1.frame = CGRectMake(btn1.right+15, lineView.bottom+23, ScreenW-55, 13);
    lab1.font = KFontPingFangSCMedium(13);
    lab1.textColor = kColorWithHex(0x666666);
    lab1.text = @"无法确定故障，请回寄产品（邮寄费用需自行承担）";
    lab1.userInteractionEnabled = YES;
    [selectBackView addSubview:lab1];
    self.lab1 = lab1;
    UITapGestureRecognizer * tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(lab1Tap)];
    [self.lab1 addGestureRecognizer:tap1];
    
    
    //已确定故障，请自行去购买点换新，发放补助金
    UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(30, btn1.bottom+23, 15, 15)];
    [btn2 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    [btn2 addTarget:self action:@selector(btn2Click) forControlEvents:UIControlEventTouchUpInside];
    [selectBackView addSubview:btn2];
    self.btn2 = btn2;
    
    UILabel *lab2 = [[UILabel alloc] init];
    lab2.frame = CGRectMake(btn2.right+15, btn1.bottom+23, ScreenW-55, 13);
    lab2.font = KFontPingFangSCMedium(13);
    lab2.textColor = kColorWithHex(0x666666);
    lab2.text = @"已确定故障，请自行去购买点换新，发放补助金";
    lab2.userInteractionEnabled = YES;
    [selectBackView addSubview:lab2];
    self.lab2 = lab2;
    UITapGestureRecognizer * tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(lab2Tap)];
    [self.lab2 addGestureRecognizer:tap2];
    
    
    //驳回申请
    UIButton *btn3 = [[UIButton alloc] initWithFrame:CGRectMake(30, btn2.bottom+23, 15, 15)];
    [btn3 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    [btn3 addTarget:self action:@selector(btn3Click) forControlEvents:UIControlEventTouchUpInside];
    [selectBackView addSubview:btn3];
    self.btn3 = btn3;
    
    UILabel *lab3 = [[UILabel alloc] init];
    lab3.frame = CGRectMake(btn3.right+15, btn2.bottom+23, ScreenW-55, 13);
    lab3.font = KFontPingFangSCMedium(13);
    lab3.textColor = kColorWithHex(0x666666);
    lab3.text = @"驳回申请";
    lab3.userInteractionEnabled = YES;
    [selectBackView addSubview:lab3];
    self.lab3 = lab3;
    UITapGestureRecognizer * tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(lab3Tap)];
    [self.lab3 addGestureRecognizer:tap3];
}

//回寄地址view
-(void)configAddressView
{
    UIView *addressBackView = [[UIView alloc]initWithFrame:CGRectMake(0,self.selectBackView.bottom+10, ScreenW, 120)];
    addressBackView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:addressBackView];
    self.addressBackView = addressBackView;
    UITapGestureRecognizer *tapGesturRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(selectAddressClick)];
    [addressBackView addGestureRecognizer:tapGesturRecognizer];
    
    //请选择审核方式
    UILabel *typeWordLab = [[UILabel alloc] init];
    typeWordLab.frame = CGRectMake(15, 10, 200, 12);
    typeWordLab.font = KFontPingFangSCMedium(13);
    typeWordLab.textColor = K333333;
    typeWordLab.text = @"回寄地址";
    [addressBackView addSubview:typeWordLab];
    
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(15,typeWordLab.bottom+10, ScreenW-30, 0.5)];
    lineView.backgroundColor = kColorWithHex(0xE5E5E5);
    [addressBackView addSubview:lineView];
    
    UIImageView *mapImage = [[UIImageView alloc]initWithFrame:CGRectMake(22, lineView.bottom+16, 12, 15)];
    mapImage.image = [UIImage imageNamed:@"地址"];
    [addressBackView addSubview:mapImage];
    
    //姓名
    UILabel *nameLab = [[UILabel alloc] init];
    nameLab.frame = CGRectMake(mapImage.right+11, lineView.bottom+16, 60, 14);
    nameLab.font = KFontPingFangSCMedium(14);
    nameLab.textColor = kColorWithHex(0x333333);
    nameLab.text = @"";
    [addressBackView addSubview:nameLab];
    self.nameLab = nameLab;
    
    
    //电话
    UILabel *phoneLab = [[UILabel alloc] init];
    phoneLab.frame = CGRectMake(nameLab.right+20, lineView.bottom+16, 150, 12);
    phoneLab.font = KFontPingFangSCMedium(12);
    phoneLab.textColor = kColorWithHex(0x333333);
    phoneLab.text = @"";
    [addressBackView addSubview:phoneLab];
    self.phoneLab= phoneLab;
    
    //地址
    UILabel *addressLab = [[UILabel alloc] init];
    addressLab.frame = CGRectMake(45, nameLab.bottom+10, ScreenW-90, 40);
    addressLab.font = KFontPingFangSCMedium(12);
    addressLab.textColor = kColorWithHex(0x333333);
    addressLab.text = @"";
    addressLab.numberOfLines = 0;
    [addressBackView addSubview:addressLab];
    self.addressLab= addressLab;
    
    self.emptyImageView = [[UIImageView alloc] initWithFrame:CGRectMake((ScreenW-120)/2, 0, 120, 120)];
    self.emptyImageView.image = [UIImage imageNamed:@"空空如也"];
    self.emptyImageView.hidden = NO;
    [addressBackView addSubview:self.emptyImageView];
    
    //箭头按钮
    UIButton *arrowBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenW-17-10, 69, 10, 17)];
    [arrowBtn setBackgroundImage:imgname(@"grayRightArrow") forState:UIControlStateNormal];
    [addressBackView addSubview:arrowBtn];
    
    
}

//点击地址View 跳转事件处理
- (void)selectAddressClick {
    ShippingAddressViewController *vc = [[ShippingAddressViewController alloc]init];
    //vc.addressBlockHandle = ^(ShippingAddressListModel * _Nonnull model) {
    vc.addressBlockHandle = ^(SelectAreaModel * _Nonnull model) {
        self.nameLab.text = model.name;       //姓名
        self.phoneLab.text = model.phone;     //电话
        self.addressLab.text = model.address; //详细地址
        self.factoryNameStr = model.name;
        self.factoryPhoneStr = model.phone;
        self.factoryAddressStr = model.address;
        self.emptyImageView.hidden = YES;
    };
    [self.navigationController pushViewController:vc animated:YES];
}

//驳回原因view
-(void)configReasonView
{
    UIView *reasonBackView = [[UIView alloc]init];
    reasonBackView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:reasonBackView];
    self.reasonBackView = reasonBackView;
    
    [reasonBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.selectBackView.mas_bottom).mas_offset(10);
        make.left.equalTo(self.view.mas_left).mas_offset(0);
        make.width.mas_equalTo(ScreenW);
        make.height.mas_greaterThanOrEqualTo(96);
    }];
    
    //驳回原因
    UILabel *reasonWordLab = [[UILabel alloc] init];
    reasonWordLab.font = KFontPingFangSCMedium(13);
    reasonWordLab.textColor = K333333;
    reasonWordLab.text = @"驳回原因";
    [reasonBackView addSubview:reasonWordLab];
    [reasonWordLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(reasonBackView.mas_top).mas_offset(10);
        make.left.equalTo(reasonBackView.mas_left).mas_offset(15);
        make.width.mas_equalTo(200);
        make.height.mas_greaterThanOrEqualTo(13);
    }];
    
    UIView *lineView = [[UIView alloc]init];
    lineView.backgroundColor = kColorWithHex(0xE5E5E5);
    [reasonBackView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(reasonWordLab.mas_bottom).mas_offset(10);
        make.left.equalTo(reasonBackView.mas_left).mas_offset(15);
        make.width.mas_equalTo(ScreenW-30);
        make.height.mas_equalTo(0.5);
    }];
    
    //原因内容
    self.reasonTextView = [[IQTextView alloc]init];
    self.reasonTextView.placeholder = @"请输入驳回原因";
    self.reasonTextView.font = KFontPingFangSCRegular(12);
    self.reasonTextView.layer.masksToBounds = YES;
    self.reasonTextView.layer.cornerRadius = 4;
    self.reasonTextView.layer.borderWidth = 0.5;
    self.reasonTextView.layer.borderColor = [UIColor colorWithHexString:@"#DBDBDB"].CGColor;
    self.reasonTextView.textColor =  K333333;
    self.reasonTextView.delegate = self;
    self.reasonTextView.text =@"";
    [reasonBackView addSubview:self.reasonTextView];
    [self.reasonTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(reasonWordLab.mas_bottom).mas_offset(25);
        make.left.equalTo(reasonBackView.mas_left).mas_offset(25);
        make.width.mas_equalTo(ScreenW-50);
        make.height.mas_equalTo(50);
        make.bottom.equalTo(reasonBackView.mas_bottom).mas_offset(-15);
    }];
}

-(void)configFooterView
{
    UIButton *sureBut = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [sureBut setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    sureBut.frame  = CGRectMake((KWIDTH-150)/2, self.selectBackView.bottom+40, 150, 32);
    [sureBut setBackgroundImage:imgname(@"按钮背景") forState:UIControlStateNormal];
    [sureBut setTitle:@"确定" forState:UIControlStateNormal];
    [sureBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    sureBut.layer.masksToBounds = YES;
    sureBut.layer.cornerRadius = 16;
    [sureBut addTarget:self action:@selector(sureButAction) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview: sureBut];
    self.sureBut = sureBut;
}
-(void)lab1Tap
{
    [self requestAddressListData];
    self.wayStr = @"1";
    self.addressBackView.hidden = NO;
    self.reasonBackView.hidden = YES;
    self.sureBut.top = self.addressBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x1EB491);
    
    
    [self.btn2 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x666666);
    
    [self.btn3 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x666666);
}
-(void)lab2Tap
{
    self.wayStr = @"2";
    self.addressBackView.hidden = YES;
    self.reasonBackView.hidden = YES;
    self.sureBut.top = self.selectBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x666666);
    
    [self.btn2 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x1EB491);
    
    [self.btn3 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x666666);
}
-(void)lab3Tap
{
    self.wayStr = @"3";
    self.addressBackView.hidden = YES;
    self.reasonBackView.hidden = NO;
    self.sureBut.top = self.reasonBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x666666);
    
    [self.btn2 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x666666);
    
    [self.btn3 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x1EB491);
    
    
    
    
}
-(void)btn1Click
{
    [self requestAddressListData];
    self.wayStr = @"1";
    self.addressBackView.hidden = NO;
    self.reasonBackView.hidden = YES;
    self.sureBut.top = self.addressBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x1EB491);
    
    
    [self.btn2 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x666666);
    
    [self.btn3 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x666666);
}

-(void)btn2Click
{
    self.wayStr = @"2";
    self.addressBackView.hidden = YES;
    self.reasonBackView.hidden = YES;
    self.sureBut.top = self.selectBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x666666);
    
    [self.btn2 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x1EB491);
    
    [self.btn3 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x666666);
}

-(void)btn3Click
{
    self.wayStr = @"3";
    self.addressBackView.hidden = YES;
    self.reasonBackView.hidden = NO;
    self.sureBut.top = self.reasonBackView.bottom+30;
    
    [self.btn1 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab1.textColor = kColorWithHex(0x666666);
    
    [self.btn2 setBackgroundImage:imgname(@"未选中") forState:UIControlStateNormal];
    self.lab2.textColor = kColorWithHex(0x666666);
    
    [self.btn3 setBackgroundImage:imgname(@"选中") forState:UIControlStateNormal];
    self.lab3.textColor = kColorWithHex(0x1EB491);
}

-(void)requestAddressListData {
    kWeakSelf;
    NSMutableDictionary *param = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [weakSelf.addressListArray removeAllObjects];
    [NetWorkTool POST:addList param:param success:^(id dic) {
        
        self.addressListArray = [ShippingAddressListModel mj_objectArrayWithKeyValuesArray:dic[@"data"]];
        for (ShippingAddressListModel *model in self.addressListArray) {
            //是否默认地址  0否1是
            if ([model.is_default isEqualToString:@"1"]) {
                self.nameLab.text = model.name;       //姓名
                self.phoneLab.text = model.phone;     //电话
                self.addressLab.text = model.address; //详细地址
                self.factoryNameStr = model.name;
                self.factoryPhoneStr = model.phone;
                self.factoryAddressStr = model.address;
                if ([model.address isEqualToString:@""]) {
                    self.emptyImageView.hidden = NO;
                } else {
                    self.emptyImageView.hidden = YES;
                }
            }
        }
    } other:^(id dic) {
        
    } fail:^(NSError *error) {
        
    } needUser:YES];
}

-(void)sureButAction
{
    
    if ([self.wayStr isEqualToString:@""]) {
        ShowToastWithText(@"请选择审核方式");
        return;
    }
    [self requestAuditGrants];
    
}
-(void)requestAuditGrants
{
    if ([self.wayStr isEqualToString:@"1"]) {
        if (self.factoryNameStr.length ==0||self.factoryPhoneStr.length ==0||self.factoryAddressStr.length ==0) {
            ShowToastWithText(@"请选择回寄地址");
            return;
        }
    } else if ([self.wayStr isEqualToString:@"2"]) {
        self.giveMoneyAlertView.hidden = NO;
        [self.view bringSubviewToFront:self.giveMoneyAlertView];
        return;
        
    } else if ([self.wayStr isEqualToString:@"3"]) {
        if (self.refuseStr.length ==0) {
            ShowToastWithText(@"请输入驳回原因");
            return;
        }
    }
    NSDictionary *param = @{
        @"way":NOTNIL(self.wayStr),//审核方式 1 （回寄配件）2 （直接同意）3（驳回）4（回寄后审核通过）
        @"id":NOTNIL(self.idStr),//补助金id
        @"factoryName":NOTNIL(self.factoryNameStr),//厂家姓名
        @"factoryPhone":NOTNIL(self.factoryPhoneStr),//厂家电话
        @"factoryAddress":NOTNIL(self.factoryAddressStr),//厂家地址
        @"refuse":NOTNIL(self.refuseStr),//驳回原因
    };
    [NetWorkTool POST:auditGrants param:param success:^(id dic) {
        
        if ([self.wayStr isEqualToString:@"1"]) {
            GrantChuLiZhongViewController * vc = [[GrantChuLiZhongViewController alloc] init];
            vc.idStr =self.idStr;
            [self.navigationController pushViewController:vc animated:YES];
        } else {
            ShenHeFinishedViewController *vc = [[ShenHeFinishedViewController alloc]init];
            vc.idStr =self.idStr;
            vc.backRootController = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
        
    } other:^(id dic) {
        ShowToastWithText(dic[@"msg"]);
        
    } fail:^(NSError *error) {
        
    } needUser:YES];
}
- (void)textViewDidEndEditing:(UITextView *)textView{
    
    self.refuseStr = textView.text;
}
// 立即发放按钮
- (IBAction)issueNowButtonClick:(UIButton *)sender {
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    param[@"id"] = self.idStr;
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    [NetWorkTool POST:factoryAuditGrants param:param success:^(id dic) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        self.balanceModel = [BalanceModel mj_objectWithKeyValues:dic[@"data"]];
        if ([self.balanceModel.type isEqualToString:@"0"]) {//1可以支付 0余额不足
            // 余额不足
            IssueNowNoMoneyAlertController * vc = [[IssueNowNoMoneyAlertController alloc] init];
            vc.model = self.balanceModel;
            vc.backButtonClick = ^{
                self.giveMoneyAlertView.hidden = YES;
            };
            [self presentViewController:vc animated:YES completion:nil];
        } else {
            IssueNowAlertController * vc = [[IssueNowAlertController alloc] init];
            vc.model = self.balanceModel;
            vc.idStr = self.idStr;
            vc.cancelButtonClick = ^{
                self.giveMoneyAlertView.hidden = YES;
            };
            vc.okButtonClick = ^{
                [self.navigationController popToRootViewControllerAnimated:YES];
            };
            [self presentViewController:vc animated:YES completion:nil];
        }
    } other:^(id dic) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
    } fail:^(NSError *error) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
    } needUser:YES];
}
// 稍后发放
- (IBAction)issueLaterButtonClick:(UIButton *)sender {
    
    self.giveMoneyAlertView.hidden = YES;
//    NSMutableDictionary *param = [NSMutableDictionary dictionary];
//    param[@"way"] = @"2";
//    param[@"id"] = self.idStr;
//    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
//    [NetWorkTool POST:auditGrants param:param success:^(id dic) {
//
//        [MBProgressHUD hideHUDForView:self.view animated:YES];
//        ShenHeFinishedViewController *vc = [[ShenHeFinishedViewController alloc]init];
//        vc.idStr =self.idStr;
//        vc.backRootController = YES;
//        [self.navigationController pushViewController:vc animated:YES];
//
//    } other:^(id dic) {
//        ShowToastWithText(dic[@"msg"]);
//        [MBProgressHUD hideHUDForView:self.view animated:YES];
//    } fail:^(NSError *error) {
//        [MBProgressHUD hideHUDForView:self.view animated:YES];
//    } needUser:YES];
}

@end
